Skip to content

Conversation

sevki
Copy link

@sevki sevki commented Sep 18, 2025

Product change and motivation

  • feat:Make pretty public.
  • fix: Pretty now prints annotations.
  • fix: suppress some build warnings.
  • feat: add derive(Quine) to AST members.

Implementation

Adds an optional quine derive feature to the package that will implement Quine
for the AST to make it possible for the ASTs to reproduce them selves.

@sevki
Copy link
Author

sevki commented Sep 18, 2025

ha. the annotation fix is already in. didn't realize that.

use std::fmt;

#[cfg(feature = "quine")]
use {polyquine::Quine, proc_macro2::TokenStream};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quine is a pretty old package - is it maintained?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's polyquine, not quine. it's actually maintained. I've contributed a couple of patches to make this bit of code work

#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "quine", derive(Quine), path_prefix(typeql::query::schema))]
pub struct Define {
    pub span: Option<Span>,
    pub definables: Vec<Definable>,
}

@flyingsilverfin
Copy link
Member

Sorry i've just had a lot come up! I need to chat with the team what we should do with these specialized implementations that are gated behind feature flags!

@sevki
Copy link
Author

sevki commented Oct 6, 2025

Hey @flyingsilverfin no worries. I got a bit stuck with this entire ordeal too due to macro site hygiene issues and haven't been able to figure out how to mix schemas and queries.

I was thinking about two approaches, both with their own downsides.

  1. Only use define and have users define their queries up front, this works really well in terms of type inference but you lose dynamic typing of queries which isn't ideal.
  2. Use both where we define a schema upfront and dynamic queries but we loose some type safety from dynamically shaped queries.

Ideally I would love to have a solution that combines both but I'm not there yet. I'll keep you updated with more information as I keep working on this.

Already responding to this has helped me figure some things out 😄

Hope you have a wonderful week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants